import React, {PureComponent} from "react";
import {View, StyleSheet, TouchableOpacity, Text, Dimensions, Image, Button, Platform} from "react-native";
import SafeAreaView from 'react-native-safe-area-view';
import color from '../../widget/color'
const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 56;
const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 0;
import {ImageButton} from '../../widget/CustomButton'
import Tips from "react-native-root-tips";
import define from "../../utils/define";
import DeviceStorage from "../../utils/DeviceStorage";

type Props = {
    navigation:any
}

export default class CourseNavigation extends PureComponent<Props> {



    render() {
        return (
            <SafeAreaView style={styles.container}>
                <View style={{alignItems:'center',flexDirection:'row',}}>
                    <ImageButton style={{marginRight:12, tintColor:color.globalMainColor}} source={require('../../../res/img/select/select_rili_icon.png')}/>
                    <View style={{flex:1}}/>
                    <Text style={{fontSize:20, color:'white', fontWeight:'bold',}}>我的课程</Text>
                    <View style={{flex:1}}/>
                    <ImageButton onPress={()=>{
                        DeviceStorage.get(define.token)
                            .then(res=>{
                                if (res){
                                    this.props.navigation.navigate('calendarSecene')
                                }else {
                                    Tips.showWarn('请先登录',{mask:true})
                                }
                            }).catch(err=>{
                        })
                    }} style={{marginRight:12}} source={require('../../../res/img/select/select_rili_icon.png')}/>
                </View>
            </SafeAreaView>
        )
    }


}
const styles = StyleSheet.create({
    container: {
        backgroundColor: color.globalMainColor,
        flexDirection: 'row',
        paddingBottom: 10,
        height: APPBAR_HEIGHT,
        alignItems: 'flex-end',
    },
    select_subject: {
        marginLeft: 12,
    },
    select_ri_li: {
        marginRight: 12,
    },
    select_search: {
        marginRight: 18,
    }
})